syntax = "proto3";

package spqr;

option go_package = "spqr/proto";

message ShardingRuleEntry {
  string column = 2;
  string hashFunction = 3;
}


message ShardingRule {
  string id = 1;
  string tableName = 2;
  repeated ShardingRuleEntry ShardingRuleEntry = 3;
}

message AddShardingRuleRequest {
  repeated ShardingRule rules = 1;
}

message AddShardingRuleReply {}

message ListShardingRuleRequest {}

message ListShardingRuleReply {
  repeated ShardingRule rules = 1;
}

message DropShardingRuleRequest {
  repeated string id = 1;
}

message DropShardingRuleReply {}

service ShardingRulesService {
  rpc AddShardingRules(AddShardingRuleRequest) returns (AddShardingRuleReply) {}
  rpc DropShardingRules(DropShardingRuleRequest) returns (DropShardingRuleReply) {}
  rpc ListShardingRules(ListShardingRuleRequest) returns (ListShardingRuleReply) {}
}
